package gameComponents;

import java.io.IOException;
import java.util.Scanner;

/**
 * Handles which game is to be launched depending on user input.
 * 
 * @author Vivian Andreeva
 */
public class Controller {
	
	/**
	 * Empty constructor.
	 */
	public Controller() {
	}
	
	/**
	 * This main method display a welcome message to the user, gets the input for how many users will be playing.
	 * It also gets input from the user(s) of which game he/she would like to play. Once the input is received, it runs
	 * the chosen game.
	 * @param args
	 * @throws IOException
	 */
	public static void main(String[] args) throws IOException {
		Scanner scan = new Scanner(System.in);
		System.out.println("WELCOME TO CHESS-VJSS");
		System.out.println("How many players will be playing today? (1 or 2)");
		String input = scan.next();
		if (input.equals("1")) {
			System.out.println("You loser! Find someone else to play with!");
			System.out.print("Alright. You can either play 1 - Knight's Tour or 2 - Eight Queens. \nWhich one will it be?");
			input = scan.next();
			choose(input);
			return;
			
		}
		System.out.println("The only two player game is chess!");
		choose("3");
	}
	/**
	 * Launches specific game (Chess, Knight's tour or Eight Queens)
	 * @param input - String which decides which game to play
	 * @throws IOException
	 * @author Vivian Andreeva
	 */
	public static void choose(String input) throws IOException {
		if (input.equals("1")) {
			SuperGame game = new KnightGame();
			game.play();
		} else if (input.equals("2")) {
			SuperGame game = new QueenGame();
			game.play();
		} else if (input.equals("3")) {
			SuperGame game = new ChessGame();
			game.play();
		}
	}
}
